<?php
/**
 * @Author: liuhongbin
 * @Email: 514660094@qq.com
 * @Date: 2019-02-12 16:15:10
 * @Description:
 * @LastEditors: liuhongbin
 * @LastEditTime: xxx
 */

namespace app\controller\adminapi\platform\wechat;


use app\controller\adminapi\platform\PlatformController;
use app\common\controller\AdminController;
use think\App;
use app\common\model\wechat\WechatRefund as WechatRefundModel;

/**
 * Class WechatRefund 微信退款
 * @package app\controller\adminapi\platform\wechat
 * User: liuhongbin
 * Date: 2021-06-19 18:15
 */
class WechatRefund extends PlatformController
{
    public $model;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->model = new WechatRefundModel();
    }

    public function index()
    {
        $res = $this->model->getPageList(['scope' => 'plaid']);
        $data = $res['data'];
        foreach ($data as $key => $value) {
            $data[$key]['user'] = $value->getUserByOpenid();
            $data[$key]['addon'] = $value->addons ?: [];
        }
        return $this->success($res['count'], $data);
    }


    /**
     * 显示指定的资源
     * @Route("restful/id", method="GET")
     * @param int $id
     * @return \think\Response
     */
    public function read($id)
    {
        //
        return $this->success("read");
    }
}
